package com.tianqu.tms.www.member.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.Logger;
import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.www.member.actionform.MemberInputActionForm;
import com.tianqu.tms.www.member.viewhelper.MemberInputViewHelper;
/**
 * 
 * 登录信息会员帐号状态确认Action
 * 
 * @author tianshifu
 *
 */
public class MemberUDLoginStatusConfirmAction extends TmsAction {

	private static final String MEMSTATUSDATA = "memStatusData";//会员状态
	
	private static final String ZC = "正常";
	
	private static final String SC = "删除";
	
	private static final String JY = "禁用";
	
	private Logger logger = Logger.getLogger(MemberUDLoginStatusConfirmAction.class);
	
	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {
		logger.debug(this.getClass().getName() + "#execute was called.");
		//从页面获取帐号状态
		MemberInputActionForm inputForm = (MemberInputActionForm)form;
		MemberInputViewHelper view = (MemberInputViewHelper)uc.getAttribute(TmsConstants.VIEWHELP);
		int memStatus = Integer.parseInt(view.getMemStatus());
		if(memStatus == 1)
		{
			view.setMemStatus(ZC);
		}
		if(memStatus == 2)
		{
			view.setMemStatus(SC);	
		}
		if(memStatus == 3)
		{
			view.setMemStatus(JY);
		}
		uc.setAttribute(TmsConstants.VIEWHELP, view);
		request.setAttribute(TmsConstants.VIEWHELP, view);
		uc.removeAttribute(MEMSTATUSDATA);
		uc.setAttribute(MEMSTATUSDATA, view);//存储会员状态
		logger.debug(this.getClass().getName() + "#execute was completed.");
		return mapping.findForward(TmsConstants.SUCCESS);
	}

}
